/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Like
 * Date: 2021-07-07
 * Time: 21:20
 */
//懒汉式
public class demoSingleton {

    private static volatile demoSingleton singleton;

    private demoSingleton() {

    }

    public static demoSingleton getInstance() {
        if (singleton == null) {
            synchronized (demoSingleton.class) {
                if (singleton == null) {
                    singleton = new demoSingleton();
                }
            }
        }
        return singleton;
    }

}